#include <iostream>
#include <string>
#include <vector>

using namespace std;

class Solution
{
public:
    int rob(vector<int> &num)
    {
        if(num.size()<1)
            return 0;

        vector<int> st;
        st.push_back(0);
        st.push_back(num[0]);
        for(int j=2; j<=num.size(); ++j)
            {
                st.push_back(max(st[j-2]+num[j-1],st[j-1]));
            }
        return st[num.size()];
    }

    int max(int a,int b)
    {
        return a>b?a:b;
    }
};

template<class T, size_t N>
size_t size(T (&)[N])
{
    return N;
}


int main()
{
    int arr[]= {2};
    int arr_size=size(arr);
    vector<int> vect(arr,arr+arr_size);
    Solution s;
    cout<<s.rob(vect)<<endl;
}